<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
%>
<jsp:include page="/manage/inc/header.jsp"></jsp:include>
<jsp:include page="/manage/inc/menu.jsp"></jsp:include>

<!--/sidebar-->
<div class="main-wrap">

	<div class="crumb-wrap">
		<div class="crumb-list">
			<i class="icon-font"></i> <a href="<%=path%>/manage/index.jsp">首页</a><span
				class="crumb-step">&gt;</span> <a class="crumb-name"
				href="<%=path%>/manage/VipServlet?action=init">类型管理</a><span
				class="crumb-step">&gt;</span><span>新增会员</span>
		</div>
	</div>
	<div class="result-wrap">
		<div class="result-content">
			<form action="<%=path%>/manage/VipServlet?action=insert"
				method="post" id="myform" name="myform"
				>
				<table class="insert-tab" width="100%">
					<tr>
						<th width="100"><i class="require-red">*</i>会员名称：</th>
						<td><input name="title" id="title" type="text"> <span
							id="titleMsg"></span></td>
					</tr>

					<tr>
						<th width="100"><i class="require-red">*</i>会员价格：</th>
						<td><input name="price" id="price" type="text"> <span
							id="priceMsg"></span></td>
					</tr>

					<tr>
						<th width="100"><i class="require-red">*</i>会员优惠：</th>
						<td><input name="discount" id="discountPrice"
							type="text"> <span id="discountPriceMsg"></span></td>
					</tr>

					<tr>
						<th></th>
						<td><input class="btn btn-primary btn6 mr10" id="subBtn"
							value="提交" type="button"> <input class="btn btn6"
							value="重置" type="reset"></td>
					</tr>
				</table>
			</form>
		</div>
	</div>
</div>
<!--/main-->
</div>
<jsp:include page="/manage/inc/footer.jsp"></jsp:include>
<script>
	$(function() {
		$("#title").blur(function() {

			var title = $.trim($("#title").val());
			if (title.length ==0) {
				$("#titleMsg").html("不能为空");
				$("#title").select();
				return;
			} else {
				$("#titleMsg").empty();
			}
		})
		//原价验证
		$("#price").blur(function() {
			var price=$(this).val();
			var priceRe=/^\d+(\.\d+)?$/;
			if(!priceRe.test(price)){
				$("#priceMsg").html("您输入的价格有误,请重新输入");
				$(this).select();
			}else{
				$("#priceMsg").empty();
			}
		});
		//折扣价验证
		$("#discountPrice").blur(function() {
			var price=$(this).val();
			var priceRe=/^[0]\d*\.\d*|0\.\d*[1-9]\d*$/;
			if(!priceRe.test(price)){
				$("#discountPriceMsg").html("您输入的折扣有误,请重新输入");
				$(this).select();
			}else{
				$("#discountPriceMsg").empty();
			}
		});
		//提交按钮
		$("#subBtn").click(function() {
			var title=$.trim($("#title").val());
			if(title.length==0){
				$("#titleMsg").html("不能为空");
				$("#title").select();
				return;
			}else{
				$("#titleMsg").html("");
			}
			var description=$.trim($("#description").val());
			
			
			$("#myform").submit();
			
		})
	})
</script>